home *** CD-ROM | disk | FTP | other *** search
-
- #include <dos.h>
- void putcur(int, int);
- cls()
- {
- union REGS inr, outr;
-
- inr.h.al = 7; /* Monochrome 80 X 25 */
- inr.h.ah = 0;
- int86(0x10, &inr, &outr);
-
- putcur(0,0);
- }
-
-
- #include <conio.h>
-
- void beep()
- {
- int x,y;
-
- x = 398 % 256;
- y = 398 / 256;
- outp(67,182);
- outp(66,x);
- outp(66,y); /* To here -sets timer freq */
- outp(97,(inp(97) | 3)); /* Sound on */
- for (y = 6000; y >0; y--)
- ; /* Stall awhile */
- outp(97,(inp(97) & 0xfc)); /* Sound off */
- }
-
-
- #include <dos.h>
- putcur(r,c)
- int r, c;
- {
- union REGS inr, outr;
- inr.h.bh = 0;
- inr.h.dh = r;
- inr.h.dl = c;
- inr.h.ah = 2;
- int86(0x10, &inr, &outr);
- }
-
-
-
- #include <dos.h>
- getcur(row, col)
- /* Return current cursor position. USAGE:
- ** getcur(&row, &col); with row and col as ints
- */
-
- int *row, *col;
- {
- union REGS inr, outr;
- inr.h.bh = 0;
- inr.h.ah = 3;
- int86(0x10, &inr, &outr);
- *row = outr.h.dh;
- *col = outr.h.dl;
- }
-
- #include <dos.h>
- writeca(c, a, cnt)
- /* writes char c with attr. a, cnt times beginning at cursor position */
- char c, a;
- int cnt;
- {
- /*
- Some attribute values:
- REVERSE VIDEO & BLNK = 0xf0;
- REVERSE VIDEO = 0X70;
- NORMAL BUT WITH BLNK = 0X87;
- NORMAL WITH NOBLNK = 0x07;
- */
- union REGS inr, outr;
- inr.h.bh = 0;
- inr.h.bl = a;
- inr.h.al = c;
- inr.x.cx = cnt;
- inr.h.ah = 9;
- int86(0x10, &inr, &outr);
- }
-
- #include <dos.h>
- void putcur(int, int);
- void writeca(char, char, int);
- putsa(s, a, row, col)
- /* put string s to console with attribute a beginning at row, col */
- char *s, a;
- int row, col;
- {
- int i;
- for(i = 0; s[i] != '\0'; i++)
- {
- putcur(row, col++);
- writeca(s[i], a, 1);
- }
- }
-
-
-